package cn.stylefeng.guns.modular.order.mapper;

import cn.stylefeng.guns.modular.order.entity.OutOrder;
import cn.stylefeng.guns.modular.order.model.params.OutOrderParam;
import cn.stylefeng.guns.modular.order.model.result.OutOrderResult;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 出库订单表 Mapper 接口
 * </p>
 *
 * @author hu
 * @since 2019-07-08
 */
public interface OutOrderMapper extends BaseMapper<OutOrder> {

    /**
     * 获取列表
     *
     * @author hu
     * @Date 2019-07-08
     */
    List<OutOrderResult> customList(@Param("paramCondition") OutOrderParam paramCondition);

    /**
     * 获取map列表
     *
     * @author hu
     * @Date 2019-07-08
     */
    List<Map<String, Object>> customMapList(@Param("paramCondition") OutOrderParam paramCondition);

    /**
     * 获取分页实体列表
     *
     * @author hu
     * @Date 2019-07-08
     */
    Page<OutOrderResult> customPageList(@Param("page") Page page, @Param("paramCondition") OutOrderParam paramCondition, @Param("condition") String condition, @Param("operateId")Long operateId);


	/**
	 * 获取单号
	 * @param paramCondition
	 * @param operateId
	 * @return
	 */
	List<OutOrderResult>  dtjOrderNumberList(@Param("paramCondition") OutOrderParam paramCondition, @Param("operateId")Long operateId);
    /**
     * 获取分页map列表
     *
     * @author hu
     * @Date 2019-07-08
     */
    Page<Map<String, Object>> customPageMapList(@Param("page") Page page, @Param("paramCondition") OutOrderParam paramCondition);

    /**
     * 查询最后一条数据
     * @return OutOrder
     */
    OutOrder findByTheLastOne();

	OutOrderResult findBySpec(@Param("paramCondition")OutOrderParam param,@Param("operateId")Long operateId);

    OutOrderResult findbyoutOrderNumber(@Param("outOrderNumber")String outOrderNumber);

	Page<OutOrderResult> getUnitlistPage(@Param("page")Page pageContext, @Param("paramCondition")OutOrderParam param
			, @Param("condition")String condition,@Param("operateId")Long operateId);

	Page<OutOrderResult> ConfirmlistPageBySpec(@Param("page")Page pageContext
			, @Param("paramCondition")OutOrderParam param, @Param("condition")String condition,@Param("operateId")Long operateId);

	Page<OutOrderResult> QuerylistPageBySpec(@Param("page")Page pageContext
			, @Param("paramCondition")OutOrderParam param, @Param("condition")String condition,@Param("operateId")Long operateId);
	
	Page<OutOrderResult> PrintlistPageBySpec(@Param("page")Page pageContext
			, @Param("paramCondition")OutOrderParam param, @Param("condition")String condition,@Param("operateId")Long operateId);

	boolean saveBatchList(@Param("list")List<OutOrderParam> list);

	Integer outOrderCount(@Param("paramCondition")OutOrderParam outOrderParam,@Param("warehouseId") Long warehouseId);

	Integer outNewOrderCount(@Param("paramCondition")OutOrderParam outOrderParam,@Param("warehouseId") Long warehouseId);

	Integer outWeiwanchengOrderCount(@Param("paramCondition")OutOrderParam outOrderParam,@Param("warehouseId") Long warehouseId);

	Integer outYuqiOrderCount(@Param("paramCondition")OutOrderParam outOrderParam,@Param("warehouseId") Long warehouseId);

	Integer outZuofeiOrderCount(@Param("paramCondition")OutOrderParam outOrderParam,@Param("warehouseId") Long warehouseId);

	OutOrderResult getPrintstorageOut(@Param("paramCondition")OutOrderParam outOrderParam);

	void updateBySpec(@Param("paramCondition")OutOrderParam outOrderParam);

	List<OutOrderResult> findListBySpec(@Param("paramCondition")OutOrderParam param, @Param("operateId")Long operateId);

	OutOrderResult findbyoutOrderNumberByDeptId(@Param("customerNumber")	String customerNumber,@Param("outOrderNumber")	String outOrderNumber, @Param("deptId")Long deptId);

	Integer insertOutOrder(OutOrderParam outOrderParam);
}
